home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
United Public Domain Gold 2
/
United Public Domain Gold 2.iso
/
utilities
/
pu015.dms
/
pu015.adf
/
StarChart
/
Source
/
star2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-09-24
|
27KB
|
790 lines
/*=========================================================================
Star2.c -- This module handles menu selection and dispatching
for the Star Chart program.
The menus used in this module were build using David Pehrson's MenuEd.
Credits for Star Chart:
Robert L. Hill of the Orange County, CA. Amiga Friends User Group
wrote the original version of StarChart in AmigaBasic
The star data and many of the main functions of this
version are derived from that program.
Ray R. Larson wrote the c version 1.0 of StarChart, 'intuitionizing'
and enhancing the speed and functions of the original.
Copyright (c) 1986 by Ray R. Larson
This program may be freely distributed and copied, but may not be sold
without the permission of the author. If you modify or enhance it,
please include the above credits (and please send me a copy!).
Ray R. Larson
6425 Central Ave. #304
El Cerrito, CA 94530
BitNet LARSON@UCBCMSA
=========================================================================*/
/*------------Header file for all of the standard stuff----*/
/*-------------plus definitions of global structures-------*/
#include "star.h"
#include <time.h>
/*---------------- External functions and variables -------*/
extern BOOL FileRequest();
extern struct Window *w;
extern struct ViewPort *vport;
extern struct star_rec StarTable[];
extern struct Coord coords[];
extern struct cons_rec Constel[];
extern char *Greek[];
extern SHORT *ConstList[];
extern SHORT *GreekList[];
extern FLOAT MaxPlus, MaxWhite;
extern struct ParamStruct Parms;
extern UBYTE WinTitle[]; /* default window title */
SHORT ZodCons[] = {2,5,9,13,29,33,35,46,49,50,54,59};
extern UWORD defaultCT[32], CTable[32], *ctabptr; /* color tables */
struct IntuiText ProjItemText[] =
{
/* 0 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"About StarChart...", NULL },
/* 1 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Locate Star by Common Name", NULL },
/* 2 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Locate Star by Greek Name", NULL },
/* 3 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Constellation Menu", NULL },
/* 4 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Help", NULL },
/* 5 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Print Help Info", NULL },
/* 6 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Exit", NULL },
};
struct IntuiText SubItemText[] =
{
/* 0 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" To Printer", NULL },
/* 1 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" To File", NULL },
};
struct IntuiText ParmItemText[] =
{
/* 0 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Set Parameters", NULL },
/* 1 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Save Parameters", NULL },
/* 2 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Load Parameters", NULL },
/* 3 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Restore Parameters", NULL },
/* 4 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Use System Time", NULL },
/* 5 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Help for Parameters", NULL },
};
struct IntuiText OptItemText[] =
{
/* 0 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Change Magnitude Display Levels", NULL },
/* 1 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Change Sidereal Clock Speed", NULL },
/* 2 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" Display Both Star & Info", NULL },
/* 3 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" Display Star Only", NULL },
/* 4 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" Display Info Only", NULL },
/* 5 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Change Screen Colors", NULL },
/* 6 */ { 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Help for Options", NULL },
};
struct MenuItem SubItems[] =
{
/* 0 */ {
&SubItems[1], 131, 0, 120, 10, ITEMENABLED | ITEMTEXT | HIGHCOMP,
0, (APTR)&SubItemText[0], NULL, '1', NULL, NULL
},
/* 1 */ {
NULL, 131, 10, 120, 10, ITEMENABLED | ITEMTEXT | HIGHCOMP,
0, (APTR)&SubItemText[1], NULL, '2', NULL, NULL
}
};
struct MenuItem ProjItems[] =
{
/* 0 */ {
&ProjItems[1], 0, 0, 251, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ProjItemText[0], NULL, 'A', NULL, NULL
},
/* 1 */ {
&ProjItems[2], 0, 10, 251, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ProjItemText[1], NULL, 'L', NULL, NULL
},
/* 2 */ {
&ProjItems[3], 0, 20, 251, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ProjItemText[2], NULL, 'G', NULL, NULL
},
/* 3 */ {
&ProjItems[4], 0, 30, 251, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ProjItemText[3], NULL, 'C', NULL, NULL
},
/* 4 */ {
&ProjItems[5], 0, 40, 251, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ProjItemText[4], NULL, 'H', NULL, NULL
},
/* 5 */ {
&ProjItems[6], 0, 50, 251, 10, ITEMENABLED | ITEMTEXT | HIGHCOMP,
0, (APTR)&ProjItemText[5], NULL, '0', &SubItems[0], NULL
},
/* 6 */ {
NULL, 0, 60, 251, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ProjItemText[6], NULL, 'Q', NULL, NULL
},
};
struct MenuItem ParmItems[] =
{
/* 0 */ {
&ParmItems[1], 0, 0, 195, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ParmItemText[0], NULL, 'P', NULL, NULL
},
/* 1 */ {
&ParmItems[2], 0, 10, 195, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ParmItemText[1], NULL, 'S', NULL, NULL
},
/* 2 */ {
&ParmItems[3], 0, 20, 195, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ParmItemText[2], NULL, 'O', NULL, NULL
},
/* 3 */ {
&ParmItems[4], 0, 30, 195, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ParmItemText[3], NULL, 'R', NULL, NULL
},
/* 4 */ {
&ParmItems[5], 0, 40, 195, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ParmItemText[4], NULL, 'T', NULL, NULL
},
/* 5*/ {
NULL, 0, 50, 195, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&ParmItemText[5], NULL, 'J', NULL, NULL
},
};
struct MenuItem OptItems[] =
{
/* 0*/ {
&OptItems[1], 0, 0, 291, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
/* 0 */ 0, (APTR)&OptItemText[0], NULL, 'M', NULL, NULL
},
/* 1*/ {
&OptItems[2], 0, 10, 291, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
/* 1 */ 0, (APTR)&OptItemText[1], NULL, 'D', NULL, NULL
},
/* 2*/ {
&OptItems[3], 0, 20, 291, 10,
CHECKIT | CHECKED | ITEMENABLED | ITEMTEXT | HIGHCOMP,
/* 2 */ 0x00000018, (APTR)&OptItemText[2], NULL, ' ', NULL, NULL
},
/* 3*/ {
&OptItems[4], 0, 30, 291, 10,
CHECKIT | ITEMENABLED | ITEMTEXT | HIGHCOMP,
/* 3 */ 0x00000014, (APTR)&OptItemText[3], NULL, ' ', NULL, NULL
},
/* 4*/ {
&OptItems[5], 0, 40, 291, 10,
CHECKIT | ITEMENABLED | ITEMTEXT | HIGHCOMP,
/* 4 */ 0x0000000C, (APTR)&OptItemText[4], NULL, ' ', NULL, NULL
},
/* 5*/ {
&OptItems[6], 0, 50, 291, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
/* 5 */ 0, (APTR)&OptItemText[5], NULL, ' ', NULL, NULL
},
/* 6*/ {
NULL, 0, 60, 291, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
/* 6 */ 0, (APTR)&OptItemText[6], NULL, 'K', NULL, NULL
},
};
struct Menu Titles[] =
{
{ &Titles[1], 3, 0, 86, 0, MENUENABLED, " Project", &ProjItems[0] },
{ &Titles[2], 88, 0, 110, 0, MENUENABLED, " Parameters", &ParmItems[0] },
{ NULL, 197, 0, 86, 0, MENUENABLED, " Options", &OptItems[0] },
};
struct IntuiText Con0MenText[] =
{
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" Display Stars Only", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" Display Both Stars & Info", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" Display Info Only", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)" Display Major Stars Only", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Show Zodiac Constellations", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Show Messier Objects", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Show NGC Galaxies", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Constellation Menus Help", NULL },
{ 0, 1, JAM1, 0, 1, NULL, (UBYTE *)"Return to Main Menu", NULL },
};
struct MenuItem Con0Items[] = {
{
&Con0Items[1], 0, 0, 250, 10,
CHECKIT | CHECKED | ITEMENABLED | ITEMTEXT | HIGHCOMP,
0x00000006, (APTR)&Con0MenText[0], NULL, ' ', NULL, NULL
},
{
&Con0Items[2], 0, 10, 250, 10,
CHECKIT | ITEMENABLED | ITEMTEXT | HIGHCOMP,
0x00000005, (APTR)&Con0MenText[1], NULL, ' ', NULL, NULL
},
{
&Con0Items[3], 0, 20, 250, 10,
CHECKIT | ITEMENABLED | ITEMTEXT | HIGHCOMP,
0x00000003, (APTR)&Con0MenText[2], NULL, ' ', NULL, NULL
},
{
&Con0Items[4], 0, 30, 250, 10,
CHECKIT | ITEMENABLED | ITEMTEXT | HIGHCOMP | MENUTOGGLE,
0, (APTR)&Con0MenText[3], NULL, ' ', NULL, NULL
},
{
&Con0Items[5], 0, 40, 250, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&Con0MenText[4], NULL, 'Z', NULL, NULL
},
{
&Con0Items[6], 0, 50, 250, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&Con0MenText[5], NULL, 'M', NULL, NULL
},
{
&Con0Items[7], 0, 60, 250, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&Con0MenText[6], NULL, 'N', NULL, NULL
},
{
&Con0Items[8], 0, 70, 250, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&Con0MenText[7], NULL, 'H', NULL, NULL
},
{
NULL, 0, 80, 250, 10, ITEMENABLED | ITEMTEXT | COMMSEQ | HIGHCOMP,
0, (APTR)&Con0MenText[8], NULL, 'R', NULL, NULL
}
};
/* the following are filled in by the InitConMenu */
struct IntuiText ConNameText[60];
struct MenuItem ConNameItems[60];
struct Menu ConTitles[] =
{
{ &ConTitles[1], 3, 0, 200, 0, MENUENABLED, " Constellation Options",
&Con0Items[0] },
{ &ConTitles[2], 201, 0, 120, 0, MENUENABLED, " A - COL ", &ConNameItems[0] },
{ &ConTitles[3], 321, 0, 120, 0, MENUENABLED, " COM - M ", &ConNameItems[20] },
{ NULL, 441, 0, 120, 0, MENUENABLED, " O - V ", &ConNameItems[40] },
};
#define PROJECT 0L
#define ABOUT 0L
#define ABOUTHELP 4L
#define LOCCOMMON 1L
#define LOCGREEK 2L
#define LOCCONS 3L
#define PROJHELP 4L
#define PRINTHELP 5L
#define EXIT 6L
#define SUBPRT 0L
#define SUBFILE 1L
#define PARMS 1L
#define SETPARM 0L
#define SAVEPARM 1L
#define LOADPARM 2L
#define RESTRPARM 3L
#define SETSYSTIME 4L
#define PARMHELP 5L
#define OPTIONS 2L
#define CHANGEMAG 0L
#define CHANGECLK 1L
#define DISBOTH 2L
#define DISSTAR 3L
#define DISINFO 4L
#define CHANGECOL 5L
#define OPTHELP 6L
#define CONOPTIONS 0L
#define CONDISSTAR 0L
#define CONDISBOTH 1L
#define CONDISINFO 2L
#define CONDISMAJ 3L
#define CONDISZOD 4L
#define CONDISMES 5L
#define CONDISNGC 6L
#define CONHELP 7L
#define CONRETURN 8L
/* string buffers for file names for saving and loading parameters */
extern UBYTE Name_String[];
UBYTE filename[140] = "";
UBYTE printfilename[140] = "";
UBYTE WTMessage[80];
UBYTE *starname;
UBYTE grkname[40], conname[40];
SHORT ErrorMessCount; /* timer count for error message */
/* DisplayFlags is used to determine how to display the star: */
/* 3 for both blink and info, 1 blink only, 2 info only */
SHORT DisplayFlags = 3;
/* ConDispFlags is used to determine how to display the constellation info */
/* 3 for both show stars and info, 1 stars only, 2 info only */
/* 4 for display major stars (greek named stars) only */
SHORT ConDispFlags = 1;
/* MenuFlag is used to determine whether the main menu or constellations */
/* menu is currently active so that the proper processing can be done */
/* True is the main menu, false is the constellation menu. */
BOOL MenuFlag = TRUE;
/* InfoFlag is used to indicate if a long or short info display is needed */
SHORT InfoFlag = 0; /* default is long info display */
/* Handle menu selections */
Do_menu(MenuNum,ItemNum,SubNum)
LONG MenuNum, ItemNum, SubNum;
{
SHORT star, starlist[60], SearchIndex(), AndLists();
UBYTE *get_Star_Name(), *extptr, *rindex(), *index(), Greekbuf[20];
FLOAT temp, get_num_req();
BOOL fileRetCode;
extern struct FileHandle *Open();
struct FileHandle *ParmFile;
SHORT greeklnum;
SHORT i,j, constindex, *conlist , nconstars;
LONG timestamp;
struct tm *timedat;
UBYTE lastchar;
if (MenuFlag) { /* Main Menu */
switch(MenuNum) {
case PROJECT:
switch(ItemNum) {
case ABOUT:
do_help_req(ABOUTHELP);
break;
case LOCCOMMON: /* locate star by name */
Name_String[0] = '\0';
starname = get_Star_Name("Enter Star Name:",NULL);
if (starname == NULL) break;
star = SearchIndex(starname);
if (star != 0)
{ if((coords[star].x == 0L) && (coords[star].y == 0L))
{ sprintf(WTMessage,
"%s is not visible at this time.",
starname);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
}
else if (DisplayFlags & 1) BlinkStar(star,7,1,8);
if (DisplayFlags & 2)
{ starlist[0] = star;
DisplayInfo(starlist,1,0,DisplayFlags);
}
}
else /*star not in star table */
{ sprintf(WTMessage,"%s is not in the Star Table.",
starname);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
}
break;
case LOCGREEK:
Name_String[0] = '\0';
starname = get_Star_Name("Enter Greek Star Name:",
"E.g. ALPHA CENTAURI");
if (starname == NULL) break;
firststr(starname,grkname,conname);
greeklnum = SearchGreek(grkname);
if (greeklnum == 0)
{ sprintf(WTMessage,
"%s is not the name of a Greek letter",
grkname);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
break;
}
constindex = SearchConst(conname);
if (constindex == 0)
{ sprintf(WTMessage,
" Constellation %s was not found",
conname);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
break;
}
star = AndLists(ConstList[constindex],GreekList[greeklnum]);
if (star != 0)
{ if (coords[star].x == 0L)
{ sprintf(WTMessage,
"%s is not visible at this time.",
starname);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
}
else if (DisplayFlags & 1) BlinkStar(star,7,1,8);
if (DisplayFlags & 2)
{ starlist[0] = star;
DisplayInfo(starlist,1,0,DisplayFlags);
}
}
else /*star not in star table */
{ sprintf(WTMessage,"%s is not in the Star Table.",
starname);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
}
break;
case LOCCONS: /* set the constellation menu */
ClearMenuStrip(w);
SetMenuStrip(w,ConTitles);
MenuFlag = FALSE;
break;
case PROJHELP:
do_help_req(PROJECT);
break;
case PRINTHELP:
if (SubNum == SUBFILE) {
if(printfilename[0] == '\0')
{ GetPath(printfilename);
lastchar = filename[strlen(printfilename)-1];
if((lastchar != ':') && (lastchar != '/'))
strcat(printfilename,"/");
strcat(printfilename,"StarChart.Manual");
}
if (FileRequest("Save Help Info to Which File?",
"Save",printfilename,
NULL,NULL,w))
{
if (PrintHelp(printfilename))
{ sprintf(WTMessage,"Couldn't Print to file %s!",
printfilename);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
}
}
}
else
if (PrintHelp("PRT:"))
{ sprintf(WTMessage,"Couldn't Use the printer!",
printfilename);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 7; /* leave it for 7 seconds */
}
break;
case EXIT:
CloseThings();
exit(NULL);
break;
};
break;
case PARMS:
switch(ItemNum) {
case SETPARM:
/* Let the user set parameters in the */
/* ParamRequester */
GetParams();
break;
case SAVEPARM: /* save current parameters in a file */
if(filename[0] == '\0')
{ GetPath(filename);
lastchar = filename[strlen(filename)-1];
if((lastchar != ':') && (lastchar != '/'))
strcat(filename,"/");
strcat(filename,"DEFAULT.STAR");
}
if (FileRequest("Where to Save Parameters?",
"Save",filename,
".info",".STAR",w))
{
extptr = rindex(filename,'.');
if(strcmp(extptr,".STAR") != 0)
strcat(filename,".STAR");
if((ParmFile =
Open(filename,MODE_NEWFILE))==NULL)
{ sprintf(WTMessage,"Couldn't open %s for output!",
filename);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 10; /* leave it for 10 seconds */
}
else { /* write out the parameters to the file */
Write(ParmFile,&Parms,(LONG)sizeof(struct ParamStruct));
Write(ParmFile,&CTable[0],(LONG)(32*sizeof(UWORD)));
/* make a workbench Icon for the file */
MakeInfoFile(filename);/* in staricon.c */
Close(ParmFile);
}
}
break;
case LOADPARM:
if (FileRequest("Which Parameters to Load?",
"Load",filename,
".info",".STAR",w))
{ if((ParmFile =
Open(filename,MODE_OLDFILE))==NULL)
{ sprintf(WTMessage,"Couldn't open %s for Input",
filename);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 10; /* leave it for 10 seconds */
}
else { /* Read the parameters from the file */
Read(ParmFile,&Parms,(LONG)sizeof(struct ParamStruct));
Read(ParmFile,&CTable[0],(LONG)(32*sizeof(UWORD)));
Close(ParmFile);
/* change the registers to the new colors */
LoadRGB4(vport,&CTable,32L);
DisplayStars();
DisplayAllText();
}
}
break;
case RESTRPARM:
/* reset to the startup parameters */
initialize();
break;
case SETSYSTIME: /* read the system clock and install */
/* current time */
timestamp = time(NULL);
timedat = localtime(×tamp);
Parms.Month = timedat->tm_mon + 1;
Parms.Day = timedat->tm_mday;
Parms.Year= timedat->tm_year + 1900;
Parms.Hour = timedat->tm_hour;
Parms.Minute = timedat->tm_min;
CalcParams(&Parms); /* calculate sidereal time, GST, etc. */
DisplayStars();
DisplayAllText();
break;
case PARMHELP:
do_help_req(PARMS);
break;
}
break;
case OPTIONS:
switch(ItemNum) {
case CHANGEMAG: GetMags(); /* put up requester for mag. */
break;
case CHANGECLK: GetTimes(); /* put up the timedelay req.*/
break;
case DISBOTH: DisplayFlags = 3; break;
case DISSTAR: DisplayFlags = 1; break;
case DISINFO: DisplayFlags = 2; break;
case CHANGECOL:
SetColors();
break;
case OPTHELP:
do_help_req(OPTIONS);
break;
}
break;
} /* end MenuNum switch */
} /* end of main menu processing */
else { /* Constellation menu processing */
if (MenuNum == CONOPTIONS)
{
switch(ItemNum) {
case CONDISSTAR:
ConDispFlags &= ~2;
ConDispFlags |= 1;
break;
case CONDISBOTH:
ConDispFlags |= 3;
break;
case CONDISINFO:
ConDispFlags &= ~1;
ConDispFlags |= 2;
break;
case CONDISMAJ:
ConDispFlags ^= 4;
break;
case CONDISZOD: /* highlight the Zodiac Constellations */
sprintf(WTMessage,
"Constellations of The Zodiac:");
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
for (i=0; i<12; i++)
PlotConst(ConstList[ZodCons[i]],1,ConDispFlags);
Delay(150L);
for (i=0; i<12; i++)
{
nconstars = PlotConst(ConstList[ZodCons[i]],3,ConDispFlags);
if (nconstars != 0)
{ sprintf(WTMessage,
"Constellations of The Zodiac: %s - The %s",
Constel[ZodCons[i]].ConsName,
Constel[ZodCons[i]].ConsMean);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
for (j = 0; j < 3; j++) /* blink the const. */
{
Delay(60L);
PlotConst(ConstList[ZodCons[i]],2,ConDispFlags);
Delay(60L);
PlotConst(ConstList[ZodCons[i]],3,ConDispFlags);
}
Delay(50L);
PlotConst(ConstList[ZodCons[i]],1,ConDispFlags);
}
}
for (i=0; i<12; i++)
PlotConst(ConstList[ZodCons[i]],0,ConDispFlags);
SetWindowTitles(w,WinTitle,(UBYTE *)-1);
break;
case CONDISMES:
sprintf(WTMessage,
"Galaxies and Nebulous Objects of the Messier Catalog");
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
PlotObjects('M',1);
Delay(200L);
PlotObjects('M',0);
SetWindowTitles(w,WinTitle,(UBYTE *)-1);
break;
case CONDISNGC:
sprintf(WTMessage,
"Galaxies and Nebulous Objects of the NGC Catalog");
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
PlotObjects('N',1);
Delay(200L);
PlotObjects('N',0);
SetWindowTitles(w,WinTitle,(UBYTE *)-1);
break;
case CONHELP:
do_help_req(CONHELP); /* 7 for constellation help */
break;
case CONRETURN: /* restore the main menu */
ClearMenuStrip(w);
SetMenuStrip(w,Titles);
MenuFlag = TRUE;
break;
};
} /* end of conoptions menu processing */
else
{ constindex = ((MenuNum - 1)*20) + (ItemNum + 1);
if (ConDispFlags & 1)
{ if(PlotConst(ConstList[constindex],1,ConDispFlags))
{ sprintf(WTMessage,
"The Constellation of %s - The %s",
Constel[constindex].ConsName,
Constel[constindex].ConsMean);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
Delay(200L);
SetWindowTitles(w,WinTitle,(UBYTE *)-1);
}
else
{ sprintf(WTMessage,
"%s - The %s - is not currently visible",
Constel[constindex].ConsName,
Constel[constindex].ConsMean);
SetWindowTitles(w,WTMessage,(UBYTE *)-1);
ErrorMessCount = 5; /* leave it for seconds */
return;
}
if (ConDispFlags & 2)
{ conlist = ConstList[constindex];
DisplayInfo(conlist+1,*conlist,1,ConDispFlags);
}
PlotConst(ConstList[constindex],0,ConDispFlags); /* clear any highlighting */
} /* end of star display part */
else if (ConDispFlags & 2)
{ conlist = ConstList[constindex];
DisplayInfo(conlist+1,*conlist,0,ConDispFlags);
}
}
} /* end of constellation menu processing */
}
/***************************************************************************
InitConMenu
***************************************************************************/
struct IntuiText GenericText = { 0, 1, JAM1, 0, 1, NULL, NULL, NULL };
struct MenuItem GenericItem =
{
NULL, 0, 0, 135, 8, ITEMENABLED | ITEMTEXT | HIGHCOMP,
0L, NULL, NULL, '\0', NULL, 0
};
InitConMenu ()
{
struct IntuiText *menu_text;
struct MenuItem *menu_items;
struct cons_rec *consdata;
SHORT i, LEdge, height;
menu_text = &ConNameText[0];
menu_items = &ConNameItems[0];
consdata = &Constel[1];
height = 0;
for (i=0; i<60; i++)
{
/*
Doing structure assignments is not portable, but then this stuff
would only work on an Amiga anyway since it is made for one.
*/
*menu_text = GenericText;
*menu_items = GenericItem;
menu_text->IText = (UBYTE *)consdata->ConsName;
menu_items->NextItem = menu_items+1; /* Link to next menu item */
menu_items->TopEdge = height;
menu_items->ItemFill = (APTR)menu_text;
height += 9;
if ((i == 19)||(i == 39))
{ menu_items->NextItem = NULL;
height = 0;
}
/* Increment all of the pointers */
menu_text++;
menu_items++;
consdata++;
}
(menu_items-1)->NextItem = NULL;
}